package org.langqiao.algorithm;
import java.util.Arrays;
public class CaiPiaoXuanHao {
	
	public static void main(String[] args) {
		//实例化一个CaiPiaoXuanHao对象
		CaiPiaoXuanHao c=new CaiPiaoXuanHao();
		c.run();//福利彩票选号器
//		c.run1();//3D彩票选号器
//		c.run2();//河南风采选号器
//		c.run3();//体育彩票选号器
//		c.run4();//体彩排列5选号器
//		c.run5();//体彩7星彩选号器
//		c.run6();//河南体育彩票选号器（36选7)
//		c.run7();//河南体育彩票选号器(29选7)
//		c.run8();//河南体育彩票选号器(22选5)
	}
	
	public void run() {
		int[] red = new int[6];
		//记录循环的次数
		int x = 0;
		//1到15随机数
		int blue = (int)(Math.random()*15+1);
		System.out.println("\t"+"福利彩票选号器："+"\n"+"\n"+"\t"+"双色球选号器："+"\n"+"号码是：");
		System.out.print("红色球是：");
		red[0] = (int)(Math.random()*32+1);
		outer:for(int i = 1;i < red.length;i++) {
			int j = 0;
			x++;
			red[i] = (int)(Math.random()*32+1);
			while(j < i) {
			    if(red[i] != red[j]) {
			       j++;
			    } else {
				   i--;
				   continue outer;
				}
			}
		}
		Arrays.sort(red);
		int y=0;
		//for(y=0;y<red.length;y++)
		while(y < red.length) {
			System.out.print(red[y]+" ");
			y++;
		}
		System.out.print("蓝色球是："+blue);
		System.out.println();
		System.out.println("本次循环总共用了"+x+"次，得到此结果！");
	}
}
